#! /bin/env python3
# coding: utf-8

import traceback

from common.load_cfg import load_cfg
from notify_media.send_mail import SendMail


def alert_admin():
    subject = 'Err: {0} Running Failed '.format(traceback.format_stack()[0].split(',')[0].strip())
    receiver = load_cfg('script_admin')
    body = traceback.format_exc()
    mail = SendMail(subject, receiver, body)
    mail.login_and_send()
    print(body)
